package co.com.inventarios.modelo;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;

/**
 * RequiDoc entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "REQUI_DOC", schema = "MANAGER", uniqueConstraints = {})
public class RequiDoc implements java.io.Serializable {

	// Fields

	private RequiDocId id;
	private Mngcco mngcco;
	private Label label;
	private Dlluser dlluser;
	private Bodega bodega;
	private Date reqfecha;
	private String reqbodsale;
	private String reqdetalle;
	private Date reqlogfec;
	private Timestamp reqenvfec;
	private Set<RequiPro> requiPros = new HashSet<RequiPro>(0);

	// Constructors

	/** default constructor */
	public RequiDoc() {
	}

	/** minimal constructor */
	public RequiDoc(RequiDocId id, Mngcco mngcco, Bodega bodega) {
		this.id = id;
		this.mngcco = mngcco;
		this.bodega = bodega;
	}

	/** full constructor */
	public RequiDoc(RequiDocId id, Mngcco mngcco, Label label, Dlluser dlluser,
			Bodega bodega, Date reqfecha, String reqbodsale, String reqdetalle,
			Date reqlogfec,Timestamp reqenvfec, Set<RequiPro> requiPros) {
		this.id = id;
		this.mngcco = mngcco;
		this.label = label;
		this.dlluser = dlluser;
		this.bodega = bodega;
		this.reqfecha = reqfecha;
		this.reqbodsale = reqbodsale;
		this.reqdetalle = reqdetalle;
		this.reqlogfec = reqlogfec;
		this.reqenvfec = reqenvfec;
		this.requiPros = requiPros;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "reqempresa", column = @Column(name = "REQEMPRESA", unique = false, nullable = false, insertable = true, updatable = true, length = 3)),
			@AttributeOverride(name = "reqclase", column = @Column(name = "REQCLASE", unique = false, nullable = false, insertable = true, updatable = true, length = 4)),
			@AttributeOverride(name = "reqtipo", column = @Column(name = "REQTIPO", unique = false, nullable = false, insertable = true, updatable = true, length = 4)),
			@AttributeOverride(name = "reqnumero", column = @Column(name = "REQNUMERO", unique = false, nullable = false, insertable = true, updatable = true, precision = 13, scale = 1)) })
	public RequiDocId getId() {
		return this.id;
	}

	public void setId(RequiDocId id) {
		this.id = id;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "REQCCOSTO", unique = false, nullable = false, insertable = true, updatable = true)
	public Mngcco getMngcco() {
		return this.mngcco;
	}

	public void setMngcco(Mngcco mngcco) {
		this.mngcco = mngcco;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "REQESTADO", unique = false, nullable = true, insertable = true, updatable = true)
	public Label getLabel() {
		return this.label;
	}

	public void setLabel(Label label) {
		this.label = label;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "REQLOGUSER", unique = false, nullable = true, insertable = true, updatable = true)
	public Dlluser getDlluser() {
		return this.dlluser;
	}

	public void setDlluser(Dlluser dlluser) {
		this.dlluser = dlluser;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "REQBODENT", unique = false, nullable = false, insertable = true, updatable = true)
	public Bodega getBodega() {
		return this.bodega;
	}

	public void setBodega(Bodega bodega) {
		this.bodega = bodega;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "REQFECHA", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public Date getReqfecha() {
		return this.reqfecha;
	}

	public void setReqfecha(Date reqfecha) {
		this.reqfecha = reqfecha;
	}

	@Column(name = "REQBODSALE", unique = false, nullable = true, insertable = true, updatable = true, length = 15)
	public String getReqbodsale() {
		return this.reqbodsale;
	}

	public void setReqbodsale(String reqbodsale) {
		this.reqbodsale = reqbodsale;
	}

	@Column(name = "REQDETALLE", unique = false, nullable = true, insertable = true, updatable = true, length = 3000)
	public String getReqdetalle() {
		return this.reqdetalle;
	}

	public void setReqdetalle(String reqdetalle) {
		this.reqdetalle = reqdetalle;
	}
	
	@Temporal(TemporalType.DATE)
	@Column(name = "REQLOGFEC", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public Date getReqlogfec() {
		return this.reqlogfec;
	}
	
	public void setReqlogfec(Date reqlogfec) {
		this.reqlogfec = reqlogfec;
	}
		
	@Column(name = "REQENVFEC", unique = false, nullable = true, insertable = true, updatable = true, length = 6)
	public Timestamp getReqenvfec() {
		return this.reqenvfec;
	}
	
	public void setReqenvfec(Timestamp reqenvfec) {
		this.reqenvfec = reqenvfec;
	}
	
	
	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "requiDoc")
	public Set<RequiPro> getRequiPros() {
		return this.requiPros;
	}

	public void setRequiPros(Set<RequiPro> requiPros) {
		this.requiPros = requiPros;
	}

}